/* 
 * File:   llist.h
 * Author: rslmanu
 *
 * Created on 17 mai 2009, 13:58
 */

/*
Copyright (C) 2009 Roussel Emmanuel

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

//Linked list manipulation

#ifndef _LLIST_H
#define	_LLIST_H

#ifdef	__cplusplus
extern "C" {
#endif


typedef struct bout{	//structure containing a bout.
    int x;
    int y;
    struct bout *suiv;	//next item in the linked list
} bout;


int ll_length(bout *p);	//return the nb of items in the list

void ll_view(bout *p);		//display the content of the list in the screen.

int ll_exist(bout *p, int x, int y);   //regarde si il existe un elt dans la liste qui a la valeur x ET y

int ll_push(bout **p, int x, int y); //put an element in the list. (at the beginning)
int ll_push_end(bout **p, int x, int y); //put an element in the list. (at the end)
int ll_pop(bout **p); //remove one item of the list (at the beginning)
int ll_pop_end(bout **p); //remove one item of the list (at the end)
bout *ll_return_last(bout *p); //return the last element in the list.

void ll_clear(bout **p);	//empty the list.


#ifdef	__cplusplus
}
#endif

#endif	/* _LLIST_H */

